package com.zyl.pts.config.validated;

import com.zyl.pts.config.anno.Status;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

/**
 * @version v1.0
 * @ProjectName: product_source
 * @Package: com.zyl.pts.config.validated
 * @ClassName: StatusValidated
 * @Description TODO()
 * @Author 翟玉龙
 * @Date 2024/11/20-10:06
 */
public class StatusValidated implements ConstraintValidator<Status, String> {

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        if(s == null || s.isEmpty()) {
            return false;
        }
        return "养殖中".equals(s)
                || "已检疫".equals(s)
                || "已出栏".equals(s)
                || "已屠宰".equals(s)
                || "已入库".equals(s)
                || "已销售".equals(s);
    }
}
